package entity

import (
	"gorm.io/gorm"
	"shqsoft.cn/pas3ui/base"
	"shqsoft.cn/pas3ui/workflow"
)

//FlowDoingSum 流程列表
type FlowDoingSum struct {
	WFID   int    `gorm:"primary_key;column:WFID"`
	EMID   int    `gorm:"column:EMID"`
	NUM    int    `gorm:"column:NUM"`
	STEPID int    `gorm:"column:STEPID"`
	WFNM   string `gorm:"-"`
	PermID int    `gorm:"-"`
}

//TableName FlowDoingSum表名
func (FlowDoingSum) TableName() string {
	return "V_FLOW_DOING_SUM"
}

func FlowDoingSumEF() base.EntityFunc {
	return func() interface{} {
		entity := FlowDoingSum{}
		return &entity
	}
}
func FlowDoingSumESF() base.EntitiesFunc {
	return func() interface{} {
		var entities []FlowDoingSum
		return &entities
	}
}

// AfterFind
func (f *FlowDoingSum) AfterFind(tx *gorm.DB) (err error) {
	wf := workflow.GetWorkFlow(f.WFID)
	if wf != nil {
		f.WFNM = wf.Name
		f.PermID = wf.PermID
	}
	return
}

func init() {
	base.DaoPoolObj.Put("FlowDoingSum", base.NewDefaultDao(FlowDoingSumEF(), FlowDoingSumESF(), nil, "my"))
}
